<template>
	<view class="list-big">
		<view style="margin-top: 20rpx;">
			
		</view>
		<navbar title="科目导航"
			rightText="私教定制"
			left-icon="left"
			@clickLeft="clickfun"
			@clickRight="goVIPpage"
		>
		</navbar>
		<view class="list">
			<!-- 左边 -->
			<scroll-view scroll-y="true" class="list-left" :style="'height:'+getheight+'px;'">
				<view v-for="(item,index) in leftdata" :key="item.taplistid" class="left-item"  @click="selectit(item.taplistid)">
					<view class="left-name" :class="item.taplistid === theindex ?'f-active-color':''">
						{{item.cateMenu}}
					</view>
				</view>
			</scroll-view>
			<!-- 	右边 -->
			<scroll-view scroll-y="true" class="list-right" :style="'height:'+getheight+'px;'">
				<view class="right-list" v-for="(item,index) in getdata" :key="index" >
					<view class="righttitle">
						{{item.newtitle}}
					</view>
					<view class="xlinel">
						
					</view>
					<view class="xliner">
						
					</view>
					<view class="righttitle-item">
						<view style="display: flex;align-items: center;flex-wrap: wrap;">
							<view class="tit" v-for="(it,ind) in item.newmtagid" @click="golistcontent(it)">
								{{it.content}}
							</view>
						</view>
						
						
					</view>
		
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	import lines from "@/components/common/Lines.vue"
	import $http from '@/common/api/request.js'
	import tarbar from '@/common/tabbar.vue'
	import navbar from "@/components/uni/uni-nav-bar/uni-nav-bar.vue"
	export default {
		data() {
			return {
				getheight: 0,
				theindex:0,
				getdata:[],
				leftdata:[],
				subformdata:{
					grade:"",
					subject:""
				},
				ismember:0
			};
		},
		methods: {
			//获取右边数据列表
			getdatalist(){
				$http.request({
					url: "/getrighttaplist",
					method:"POST",
					data:{
						id:this.theindex
					}
				}).then((res) => {
					uni.showToast({
						title: "获取数据中...",
						icon: "none",
						mask: true,
						duration: 200,
						success: () => {
							this.getdata = res;
							
						}
					})
				
				}).catch(() => {
					uni.showToast({
						title: "获取listdata_r数据失败",
						icon: "error",
						mask: true,
						duration: 2000
					})
				})
			},
			//获取左滚动窗的数据-leftdata
			getlistdata_l(){
				$http.request({
					url: "/getletftaplist"
				}).then((res) => {
					uni.showToast({
						title: "获取数据中...",
						icon: "none",
						mask: true,
						duration: 500,
						success: () => {
							this.leftdata = res;
							
						}
					})
				
				}).catch(() => {
					uni.showToast({
						title: "获取getlistdata_l数据失败",
						icon: "error",
						mask: true,
						duration: 2000
					})
				})
			},
			//获取高度
			getClientHeight() {
				const res = uni.getSystemInfo();
				const system = res.platform;
				if (system === 'ios') {
					return 44 + res.statusBarHeight;
				} else if (system === 'android') {
					return 48 + res.statusBarHeight;
				} else {
					return 0
				}
			},
			selectit(index){
				this.theindex = index;
				this.getdatalist()
			},
			//前往匹配教师页面:
			golistcontent(item){
				//年级
				if(item.mtagid === 0){
					this.subformdata.grade = "小学"
				}else{
					this.subformdata.grade = item.content.substring(0, 2)
				}
				this.subformdata.subject = item.cateMenu;//学科
				//跳转教师页面:
				this.navigateTo({
					url:`/pages/tapteacherlist/tapteacherlist?subformdata=${JSON.stringify(this.subformdata)}`
				})
			},
			clickfun(){
				// uni.navigateBack({
				// 	delta:1
				// })
				uni.navigateTo({
					url:"/pages/list/list"
				})
			},
			
			goVIPpage(){
				
				this.navigateTo({
					url:"/pages/vipketang/vipketang"
				})
			}
		},
		components: {
			lines,tarbar,navbar
		},
		onReady() {
			this.getdatalist();
			this.getlistdata_l();
			uni.getSystemInfo({
				success: (res) => {
					this.getheight = res.windowHeight  -this.getClientHeight()
			
				}
			})	
		}
	}
</script>

<style lang="scss">
	scroll-view ::-webkit-scrollbar{
		display: none !important;
		width: 0 !important;
		height: 0 !important;
		-webkit-appearance: none;
		background:transparent;
	}
	.list-big {

		.list-weixin-top {

			// align-items: center;
			padding: 20rpx 20rpx;
			height: 180rpx;
			background-color: #f7f7f7;

			.list-weixin {
				display: flex;
				justify-content: space-around;
				margin-top: 120rpx;

				.list-weixin-top-img {
					width: 40rpx;
					height: 40rpx;
				}

				.list-weixin-top-tetx {
					width: 550rpx;
					height: 100%;
					font-size: 36rpx;
				}

			}

		}

		.list {
			display: flex;
			.list-left {
				display: flex;
				width: 200rpx;
				.f-active-color{
					background-color: #19be6b;
					color: #f7f7f7;
				}
				.left-item{
					padding: 5rpx 10rpx;
				}
				.left-name {
					height: 35px;
					display: flex;
					justify-content: center;
					align-items: center;
					font-size: 28rpx;
					border-bottom: 1rpx solid #f2f2f2;
				}
				.clickleftname{
					
				}
			}

			.list-right {
				margin-bottom:120rpx ;
				.right-list {
					width: 600rpx;
					margin: 15rpx 0;
					position: relative;
					.righttitle{
						font-weight: 600;
						font-size: 32rpx;
						display: flex;
						justify-content: center;
					}
					.xlinel{
						position: absolute;
						left: 0;
						top: 20rpx;
						width: 40%;
						border-bottom: 1rpx dashed  #b0b0b0;
					}
					.xliner{
						position: absolute;
						right: 0;
						top: 20rpx;
						width: 40%;
						border-bottom: 1rpx dashed  #b0b0b0;
					}
					.righttitle-item{
						.tit{
							width: 170rpx;
							margin: 10rpx;
							font-size: 28rpx;
							padding: 10rpx 0;
							background-color: #fafafa;
							display: flex;
							justify-content: center;
						}
					}
					.r-l-img{
						width: 200rpx;
						height: 200rpx;
					}
					.r-l-r{
						margin: 10rpx 0;
						.r-l-t{
							font-size: 30rpx;
							font-weight: 800;
							 display: -webkit-box;
							  -webkit-line-clamp: 1;
							  -webkit-box-orient: vertical;
							  overflow: hidden;
						}
						.r-l-c{
							font-size: 24rpx;
							margin: 15rpx 0;
							display: -webkit-box;
							 -webkit-line-clamp: 3;
							 -webkit-box-orient: vertical;
							 overflow: hidden;
						}
						.r-l-time{
							font-size: 20rpx;
						}
					}
					
					.list-title {
						padding: 20rpx 20rpx;
						font-size: 38rpx;
						font-weight: 800;
					}

					.right-content {
						display: flex;
						flex-wrap: wrap;
						.right-item {
							width: 195rpx;
							height: 200rpx;
							.right-img {
								padding: 0rpx 25rpx;
								width: 70%;
								height: 70%;
							}
							.right-name {
								display: flex;
								align-items: center;
								justify-content: center;
							}
						}
					}
				}
			}
		}
	}
</style>
